<?php
/*
|--------------------------------------------------------------------------
| 葫芦家 V1 版本
|--------------------------------------------------------------------------
|
| 商品
| 订单
| 秒杀
| 购物车
| 个人中心
| 上线活动页
|
*/

// 注册登录
Route::post('register', 'AuthController@mpRegister');

// 退出
Route::post('member/logout', 'AuthController@logout')->middleware('auth:api');

// 获取物流公司
Route::any('logistic/company', 'CommonController@getLogistiCompany');

//验证码
Route::post('sms/code', 'CommonController@verificationCode');

//微信支付
Route::post('pay/wechat', 'PayController@wehcatPay')->middleware('auth:api');

// 商品分享
Route::post('goods/share', 'CommonController@shareImg');
// 分享2
Route::post('goods/share/friend', 'CommonController@shareGoods');

// 上传
Route::post('upload', 'CommonController@upload')->middleware('auth:api');


 // 版本控制路由
Route::group([
    'prefix' => 'v1',
    'namespace' => 'V1',
], function() {

    // 商品(搜索）
    Route::resource('products', 'ProductsController');

    // 首页
    Route::post('home', 'HomeController@index');

    // 分类
    Route::any('categroy', 'CategroyController@index');
    // 获取子级分类
    Route::any('category/children', 'CategroyController@getChildrenCate');

    // 获取秒杀产品
    Route::post('seckill/list', 'ProductsController@getSeckillProducts');

    // 领取优惠券h5
    Route::post('coupon/list', 'CouponController@getCouponList');

    // 需要登陆的路由
    Route::group(['middleware' => ['auth:api']], function(){

        // 绑定手机号
        Route::post('member/bind/mobile', 'MemberController@bindMobile');

        // 获取用户信息
        Route::post('member/userinfo', 'MemberController@userinfo');

        //我的流水记录
        Route::post('member/water', 'MemberController@water');

        // 绑定手机号（授权）
        Route::post('member/bind/minimobile', 'MemberController@bindMiniMobile');

        // 会员中心
        Route::post('member/index', 'MemberController@memberIndex');

        //我的优惠券
        Route::post('member/coupons', 'CouponController@memberCoupon');

        // 领取优惠券
        Route::post('coupons/receive', 'CouponController@receiveCoupon');

        // 购物车
        Route::resource('cart', 'CartController');
        // 减购物车
        Route::post('cart/reduce/{id}', 'CartController@reduce');

        // 地址
        Route::resource('address', 'AddressController');

        // 确认订单页
        Route::post('confirm/order', 'OrderController@confirmOrder');

        // 用户下单
        Route::post('order/store', 'OrderController@store');

        // 秒杀下单
        Route::post('order/seckill', 'OrderController@seckill');

        // 我的订单
        Route::post('order/list', 'OrderController@orderList');

        // 取消订单
        Route::post('order/cancel', 'OrderController@cancelOrder');

        // 确认收货
        Route::post('order/received', 'OrderController@receivedOrder');

        // 删除订单
        Route::post('order/delete', 'OrderController@deleteOrder');

        // 退款
        Route::post('order/refund', 'OrderController@refundOrder');

        // 订单详情
        Route::post('order/detail', 'OrderController@orderDetail');

        // 物流信息
        Route::post('order/logistics', 'OrderController@logisticsDetail');

        // 售后确认页面
        Route::post('after/sale/list', 'AfterSaleController@AfterSaleList');

        // 售后列表
        Route::get('after/sale/list', 'AfterSaleController@afterSaleLists');

        // 售后详情
        Route::get('after/sale/detail/{id}', 'AfterSaleController@afterSaleDetail');

        // 售后服务
        Route::post('after/sale/server', 'AfterSaleController@afterSaleServer');

        // 售后
        Route::post('after/sale', 'AfterSaleController@AfterSale');
        // 售后填写物流单号
        Route::post('after/sale/logistics', 'AfterSaleController@afterSaleLogistics');

        // 提现
        Route::resource('withdraw', 'WithdrawController');


    });
});
